
MoveJump.prototype = new Move();

function MoveJump (io_obj, piece_obj, src_loc_obj, dest_loc_obj) {
	/** HERITAGE */
	this.parent = Move;
	this.parent (io_obj, piece_obj, src_loc_obj, dest_loc_obj);
	/** PRIVATE */
	this._max_distance = null;
	this._moveX = null;
	this._moveY = null;

	/** PUBLIC */
	this._constructor = 
		function moveJump__constructor () {
			this.print("MoveJump._constructor -- ok");
			// do nothing
			this._max_distance = 8;
		}

	this.setJump = function moveJump_setJump (move_x, move_y){
		this._moveX = move_x;
		this._moveY = move_y;
	}

	this.setMaxDistance = function move_setMaxDistance (dist){
		this._max_distance = dist + 1;
	}

	/* FIXME: ugly hack... */
	this.parent_isDestinationReachable = this.isDestinationReachable;
	this.isDestinationReachable = function moveJump_isDestinationReachable(){
		var result;
		
		if (((Math.abs(this._diffX) == this._moveX)
					&& (Math.abs(this._diffY) == this._moveY))
				|| ((Math.abs(this._diffX) == this._moveY)
					&& (Math.abs(this._diffY) == this._moveX))) {
			result = this.parent_isDestinationReachable();
		} else {
			result = false;
		}
		return result;
	}

	this.isPossible = function moveJump_isPossible () {
		var result;
		result = this.isDestinationReachable ();			
		this.print("MoveJump.isPossible -- destination is reachable? "+result);
		return result;
	}

	/** CONSTRUCT ! */
	this._constructor ();
}

